import request from '../utils/request'
import * as T from './actionTypes'
module.exports = {
    namespace: 'user',
    state: {
        list: []
    },
    effects: {
        *[T.user_query]({ payload }, { call, put }) {
            let list = yield call(request, '/api/users');
            yield put({ type: "save", payload: list });
        }
    },
    reducers: {
        save(s, { payload }) {
            console.log(payload);
            let mm = {
                ...s,
                list: payload.data
            }
            //console.log(mm);
            return mm;
        }
    }
}